<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    //获得今天日期时间
    let d = new Date();
    //设置时间为下午16:00:00
    d.setHours(0, 0, 0, 0);
    //获得今天与星期五的日差
    let week = 5 - (d.getDay() < 5 ? d.getDay() : d.getDay() == 7 ? 0 : -1);
    //今天下午16:00:00的时间戳 加上今天与周五的日差秒数得到结果时间戳
    let result = d.getTime() + week * 86400000;
    let totay = Date.parse(new Date());
    var seconds = (result - totay) / 1000
    var days = Math.floor(seconds / (3600 * 24));
    seconds = seconds % (3600 * 24);
    var hours = Math.floor(seconds / 3600);
    seconds = seconds % 3600;
    var minutes = Math.floor(seconds / 60);
    seconds = seconds % 60;
    console.log(d.getDay())
    console.log(seconds)
    console.log(days)
    console.log(hours)
    console.log(minutes)
    console.log(result)
    console.log(totay)
</script>

</html>